<template>
	<view class="container">
		<u-loading-page color="#333" :loading="loading" icon-size="80" loading-text="loading..."
			:image="baseUrl + '/static/loading.gif'" loading-mode="spinner"></u-loading-page>
		<view v-if='!loading'>
			<view class="info-list">
				<view v-for='item in infoList' :key='item.id'>
					<u-collapse>
						<u-collapse-item :title="item.itemname" v-for='item in infoList' :key='item.id'>
							<view class="info-item">

								<view class="item-line">
									<view>门诊号</view>
									<view>{{item.outpatient}}</view>
								</view>
								<view class="item-line">
									<view>姓名</view>
									<view>{{item.customername}}</view>
								</view>
								<view class="item-line">
									<view>项目</view>
									<view>{{item.itemname}}</view>
								</view>

								<view class="item-line">
									<view>项目类型</view>
									<view>{{item.itemtype}}</view>
								</view>
								<view class="item-line">
									<view>规格</view>
									<view>{{item.specifications}}</view>
								</view>
								<view class="item-line">
									<view>数量</view>
									<view>{{item.number}}</view>
								</view>
								<view class="item-line">
									<view>单位</view>
									<view>{{item.unit}}</view>
								</view>
								<view class="item-line">
									<view>结账金额</view>
									<view>{{item.amount}}</view>
								</view>
								<view class="item-line">
									<view>结账时间</view>
									<view>{{item.operatetime}}</view>
								</view>
							</view>
						</u-collapse-item>
					</u-collapse>
				</view>
			</view>
			<view class="empty-box" v-if='!infoList.length'>
				<u-empty mode="history" icon="http://cdn.uviewui.com/uview/empty/history.png">
				</u-empty>
			</view>
		</view>
	</view>
</template>
<script>
	import timeline from "@/pages-center/components/chenbin-timeline/timeLine.vue";
	import timelineItem from "@/pages-center/components/chenbin-timeline/timelineItem.vue";
	import {
		expenseRecord
	} from '@/api/axios/center.js'
	export default {
		data() {
			return {
				baseUrl: this.staticURL,
				loading: true,
				infoList: []

			}
		},
		components: {
			timeline,
			timelineItem
		},
		methods: {

		},
		onLoad() {
			let customerId = uni.getStorageSync('customerId')
			let wePhone = uni.getStorageSync('wePhone')
			expenseRecord({
				params: {
					customerId: customerId,
					phone: wePhone,
					pageNo: 1,
					pageSize: 100000,
				}
			}).then(res => {
				this.loading = false
				this.infoList = res.records.map(item => {
					item.operatetime = item.operatetime.split(' ')[0]
					return item
				})
				// console.log(this.infoList);
			})
		}
	}
</script>
<style scoped lang="scss">
	@import './index.scss'
</style>